package cc.wanforme.st.server.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;

@Configuration
public class MybatisIdentifierConfiguration {
	
	@Value("${snowflake-id.dataCenter-id}")
	private long dataCenterId;
	@Value("${snowflake-id.worker-id}")
	private long workerId;
	
	@Bean
	public IdentifierGenerator DefaultIdentifierGenerator() {
		return new com.baomidou.mybatisplus.core.incrementer.DefaultIdentifierGenerator(workerId, dataCenterId);
	}
}
